home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 3 / Amoszine 3.adf / sticks_ext / sticks-demos / Mouse.AMOS / Mouse.amosSourceCode < prev    next >
Encoding:
AMOS Source Code  |  1992-02-26  |  4.5 KB  |  211 lines

  1. Dim X(20),Y(20)
  2. Break Off 
  3. Global MNO
  4. I=Execall(-132) : Rem Forbid   
  5. Screen Open 0,320,200,4,Lowres
  6. Palette $79A,$245,$EFF,$9BC,$0,$FFF : Colour Back Colour(0) : View 
  7. Reserve Zone 7
  8. Flash Off : Curs Off : Cls 0 : Paper 0
  9. '
  10.  Extension_17_0116 1
  11.  Extension_17_0116 0
  12. '
  13. NO$="0" : MNO=0
  14. BUTTONS:
  15. Data 0,0,,20,NO$,"Mouse Port"
  16. Data 51,34,,20,"Click here for Multi Mouse",""
  17. Data 51,60,,20,"Click for Smouse",""
  18. Data 51,87,,20,"Click here for Tricky Mouse",""
  19. Data 51,115,,20,"Click here for Awkward Mouse",""
  20. Data 51,143,,20,"Click here for Normal Mouse",""
  21. Data 51,171,,20,"Click here to QUIT",""
  22. Restore BUTTONS
  23. For A=1 To 7
  24.    Read X,Y,X1,Y1,T$,L$
  25.    _MYBUTTONS[A,X,Y,X1,Y1,T$,L$,True]
  26. Next A
  27. Hide 
  28. Double Buffer 
  29. Autoback 1
  30. Bob Update Off 
  31. Do 
  32.    X= Extension_17_00DA(MNO) : Y= Extension_17_00F4(MNO)
  33.    Sprite 0,X,Y,1
  34.    MZ= Extension_17_0132(MNO)
  35.    If Extension_17_011E(MNO) and MZ>0
  36.       M=MZ
  37.       If M=1 : Gosub 1 : End If 
  38.       Gosub INDENT
  39.       If M=2 : Gosub 2 : End If 
  40.       If M=3 : Gosub 3 : End If 
  41.       If M=4 : Gosub 4 : End If 
  42.       If M=5 : Gosub 5 : End If 
  43.       If M=6 : Gosub 6 : End If 
  44.       If M=7 : Gosub 7 : End If 
  45.    End If 
  46.    '
  47.    If M=2 Then Gosub MULTI
  48.    If M=3 Then Gosub SOFT
  49.    If M=4 Then Gosub TRICKY
  50.    If M=5 Then Gosub AWKARD
  51. Loop 
  52. '
  53. CLEAR:
  54. For A=0 To 20
  55.    Bob Off A : X(A)=0 : Y(A)=0
  56. Next A
  57. Bob Update 
  58. Return 
  59.  
  60. INDENT:
  61. Gosub CLEAR
  62. Restore BUTTONS
  63. For A=0 To MZ-1
  64.    Read X,Y,X1,Y1,T$,L$
  65. Next A
  66. _MYINDENT[MZ,X,Y,X1,Y1,T$,True,True]
  67. Return 
  68.  
  69. 1 For N=2 To 7 : Sprite N,0,0, : Next 
  70. If MNO=0 Then MNO=1 Else MNO=0
  71. NO$=Str$(MNO)-" "
  72. Print NO$
  73. Return 
  74.  
  75. 2 N=0
  76. For N=2 To 7
  77.    X(N)= Extension_17_00DA(MNO)
  78.    Y(N)= Extension_17_00F4(MNO)
  79.    Sprite N,X(N),Y(N),1
  80. Next 
  81. Return 
  82. '
  83. '
  84. '
  85. '
  86. 3 For N=2 To 7 : Sprite N,0,0, : Next 
  87. X= Extension_17_00DA(MNO) : Y= Extension_17_00F4(MNO) : Sprite 1,X,Y,1 : Hide On 
  88. Return 
  89. '
  90. '
  91. 4
  92. For N=2 To 7 : Sprite N,0,0, : Next 
  93. Return 
  94. '
  95. '
  96. 5
  97. For N=2 To 7 : Sprite N,0,0, : Next 
  98. Return 
  99. '
  100. '
  101. '
  102. 6 For N=2 To 7 : Sprite N,0,0, : Next 
  103. Return 
  104. '
  105. 7
  106. I=Execall(-138) : Rem Permit   
  107. Break On 
  108. Edit 
  109. MULTI:
  110. X(0)= Extension_17_00DA(MNO) : Y(0)= Extension_17_00F4(MNO)
  111. For N=1 To 7
  112.    X=Abs(X(N)-X(N-1))
  113.    Y=Abs(Y(N)-Y(N-1))
  114.    If X(N)>X(N-1) Then Add X(N),-(X/4)
  115.    If X(N)<X(N-1) Then Add X(N),X/4
  116.    If Y(N)>Y(N-1) Then Add Y(N),-(Y/4)
  117.    If Y(N)<Y(N-1) Then Add Y(N),Y/4
  118.    Sprite N,X(N),Y(N),2
  119. Next 
  120. Return 
  121.  
  122. TRICKY:
  123. A= Extension_17_00DA(MNO) : C= Extension_17_00F4(MNO)
  124. Repeat 
  125.    Wait Vbl 
  126.    B= Extension_17_00DA(MNO) : D= Extension_17_00F4(MNO)
  127. Until A<>B or C<>D or Extension_17_011E(MNO)
  128. If A<B and X>142 Then Add X,-4
  129. If A>B and X<434 Then Add X,4
  130. If C<D and Y>64 Then Add Y,-4
  131. If C>D and Y<236 Then Add Y,4
  132. ' Mouse Clip MNO 
  133.  Extension_17_00C8 MNO,X : Extension_17_00E2 MNO,Y : Sprite 1,X,Y,1
  134. Return 
  135. AWKARD:
  136. Repeat 
  137.    If Rnd(29)=1
  138.        Extension_17_00C8 MNO, Extension_17_00DA(MNO)+Rnd(2)-1
  139.        Extension_17_00E2 MNO, Extension_17_00F4(MNO)+Rnd(2)-1
  140.       X= Extension_17_00DA(MNO)
  141.       Y= Extension_17_00F4(MNO)
  142.       Sprite 0,X,Y,1
  143.    End If 
  144. Until Extension_17_011E(MNO)
  145. Return 
  146.  
  147. SOFT:
  148. X(0)= Extension_17_0156(MNO) : Y(0)= Extension_17_0170(MNO)
  149. For N=1 To 15
  150.    X=Abs(X(N)-X(N-1))
  151.    Y=Abs(Y(N)-Y(N-1))
  152.    If X(N)>X(N-1) Then Add X(N),-(X/4)
  153.    If X(N)<X(N-1) Then Add X(N),X/4
  154.    If Y(N)>Y(N-1) Then Add Y(N),-(Y/4)
  155.    If Y(N)<Y(N-1) Then Add Y(N),Y/4
  156.    Bob N,X(N),Y(N),1
  157. Next 
  158. Bob Update 
  159. Wait Vbl 
  160. Return 
  161. Procedure _MYBUTTONS[NO,X,Y,XW,Y1,TEX$,LABEL$,FLAG]
  162.    Set Pattern 0
  163.    Gr Writing 1
  164.    Shared WINDCOL
  165.    If XW<(Len(TEX$))*8 : XW=(Len(TEX$)+2)*8 : End If 
  166.    H=Y1
  167.    X1=XW+X
  168.    Y1=Y1+Y-1
  169. Ink WINDCOL
  170.    Bar X,Y To X1,Y1
  171.    Set Zone NO,X,Y To X1,Y1
  172.    If FLAG=-1 Then Ink 1 Else Ink 2
  173.    Box X,Y To X1,Y1
  174.    If FLAG=-1 Then Ink 2 Else Ink 1
  175.    Polyline X,Y1 To X,Y To X1,Y
  176.    H=H/2
  177. L=Text Length(TEX$)
  178.    Ink 1,WINDCOL : DROPTEXT[X1-XW/2-L/2,Y+H+2,TEX$]
  179.    If LABEL$>""
  180.    DROPTEXT[X1+5,Y+H+2,LABEL$]
  181.      End If 
  182. End Proc
  183. Procedure _MYINDENT[NO,X,Y,XW,YH,TEX$,FLAG,_WAITMK]
  184.    Set Pattern 0
  185.    Gr Writing 1
  186.    Shared WINDCOL
  187.    If XW<(Len(TEX$))*8 : XW=(Len(TEX$)+2)*8 : End If 
  188.    H=YH
  189.    X1=XW+X
  190.    Y1=YH+Y-1
  191.    Ink 3 : Bar X,Y To X1,Y1
  192.    If FLAG=-1 Then Ink 2 Else Ink 1
  193.    Box X,Y To X1,Y1
  194.    If FLAG=-1 Then Ink 1 Else Ink 2
  195.    Polyline X,Y1 To X,Y To X1,Y
  196.    L=Text Length(TEX$)
  197.    H=H/2
  198.    Ink 1,3 : DROPTEXT[X1-XW/2-L/2,Y+H+2,TEX$]
  199.    If _WAITMK : Repeat : Multi Wait : Until Extension_17_011E(MNO)=0 : End If 
  200.    _MYBUTTONS[NO,X,Y,XW,YH,TEX$,"",FLAG]
  201. End Proc
  202. Procedure DROPTEXT[X,Y,T$]
  203. Autoback 2
  204.    Gr Writing 0
  205.    Ink 1
  206.    Text X+1,Y+1,T$
  207.    Ink 2
  208.    Text X,Y,T$
  209.    Gr Writing 1
  210. Autoback 1
  211. End Proc